<!DOCTYPE html>
<!--
/*******************************************************************************
#      ____               __          __  _      _____ _       _               #
#     / __ \              \ \        / / | |    / ____| |     | |              #
#    | |  | |_ __   ___ _ __ \  /\  / /__| |__ | |  __| | ___ | |__   ___      #
#    | |  | | '_ \ / _ \ '_ \ \/  \/ / _ \ '_ \| | |_ | |/ _ \| '_ \ / _ \     #
#    | |__| | |_) |  __/ | | \  /\  /  __/ |_) | |__| | | (_) | |_) |  __/     #
#     \____/| .__/ \___|_| |_|\/  \/ \___|_.__/ \_____|_|\___/|_.__/ \___|     #
#           | |                                                                #
#           |_|                 _____ _____  _  __                             #
#                              / ____|  __ \| |/ /                             #
#                             | (___ | |  | | ' /                              #
#                              \___ \| |  | |  <                               #
#                              ____) | |__| | . \                              #
#                             |_____/|_____/|_|\_\                             #
#                                                                              #
#                              (c) 2010-2012 by                                #
#           University of Applied Sciences Northwestern Switzerland            #
#                     Institute of Geomatics Engineering                       #
#                           martin.christen@fhnw.ch                            #
********************************************************************************
*     Licensed under MIT License. Read the file LICENSE for more information   *
*******************************************************************************/

                TUTORIAL 12.1: Create a GeoJSON and display on Terrain

*******************************************************************************/-->
<html>
    <head>
        <script type="text/javascript" src="../../../external/closure-library/closure/goog/base.js"></script>
        <script type="text/javascript" src="../../../compiled/deps.js"></script>
        <script type="text/javascript">goog.require('owg.OpenWebGlobe');</script>
    </head>
    <body style="padding:0px; margin:0px; overflow:hidden;">
        <div style="width: 100%; height: 100%;">
            <canvas id="canvas">
            </canvas>
        </div>
    <script type="text/javascript">
       ogSetArtworkDirectory("http://www.openwebglobe.org/art/");
        var context = ogCreateContextFromCanvas("canvas", true);
        var globe = ogCreateGlobe(context);
        ogAddImageLayer(globe, {
         url: ["http://www.openwebglobe.org/data/img"],
         layer: "bluemarble",
         service: "owg"
        });
        ogAddImageLayer(globe, {
            url: ["http://www.openwebglobe.org/data/img"],
            layer: "LandsatCH",
            service: "i3d"
        });
        ogAddElevationLayer(globe, {
            url: ["http://www.openwebglobe.org/data/elv"],
            layer: "SRTM",
            service: "i3d"
        });

      var scene = ogGetScene(context);
      var world = ogGetWorld(scene);

      // Create a vector layer and add some
      var vectorlayer = ogAddVectorLayer(world, {"id": "Switzerland"});


      var data = {
         "type": "FeatureCollection",
         "features" :
            [
               {
                  "type" : "Feature",
                  "properties":
                  {
                     "id" : "Switzerland",
                     "color" : [1,0,1,1],
                     "highlightcolor" : [1,0,0,1],
                     "linewidth" : 5000,
                     "minelv" : -2000,
                     "maxelv" : 5000
                  },
                  "geometry":
                  {
                     "type" : "LineString",
                     "coordinates" :
                        [
                           [7.579479, 47.558226],
                           [9.461517, 47.587642],
                           [9.512891, 45.978481],
                           [7.179479, 47.561362],
                           [7.579479, 47.558226]
                        ]
                  }
               }
            ]
      }
      // Create a vector layer and add some
      var vectorlayer = ogAddVectorLayer(world, {"id": "Switzerland"});
      ogAddGeoJSON(vectorlayer, data);


    </script>
    </body>
</html>
